import * as types from '../mutation-types'

const state = {
	// 确认订单State
	confirmOrderNumber: "123456",               // 订单编号
	isPayOnline: 1,                             // 选择线上、线下支付
	
	invoiceType: 0,                             // 发票类型
}
 
const getters = {
	
}

const mutations = {
	// 确认订单Mutations
	// 1. 获取选择订单编号
	[types.CHANGE_ORDER_NUMBER]: function(state, num){
		state.confirmOrderNumber = num;
	},
	// 2. 选择线上、线下支付
	[types.SELECT_PAY_ONLINE]: function(state, num){
		state.isPayOnline = num;
	},
	// 3. 选择发票类型
	[types.SELECT_INVOICE_TYPE]: function(state, num){
		state.invoiceType = num;
	}
	
}

const actions = {
	// 确认订单Mutations
	// 1. 获取选择订单编号
	changeOrderNumber ({commit}, num){
		commit(types.CHANGE_ORDER_NUMBER, num);
	},
	// 2. 选择线上、线下支付
	selectPayOnline ({commit}, num){
		commit(types.SELECT_PAY_ONLINE, num);
	},
	// 3. 选择发票类型
	selectInvoiceType ({commit}, num){
		commit(types.SELECT_INVOICE_TYPE, num);
	}
}

export default {
	state,
	getters,
	mutations,
	actions
}
